import {axios} from '@/utils/request'

// 设备列表
export function list(devId, pageNo, pageSize) {
  return axios({
    url: `/fabr/fabrDevice/list?devId=${devId}&pageNo=${pageNo}&pageSize=${pageSize}`,
    method: 'get'
  })
}

// 查询
export function query() {
  return axios({
    url: `/fabr/fabrDevice/deviceAllList`,
    method: 'GET',
  })
}

// 总数
export function queryStatusCount() {
  return axios({
    url: `/fabr/fabrDevice/deviceStatusCount`,
    method: 'GET',
  })
}

// 柱状图
export function queryTypeCount() {
  return axios({
    url: `/fabr/fabrDevice/deviceTypeStatistics`,
    method: 'GET',
  })
}

// 设备巡查-添加
export function add(parameter) {
  return axios({
    url: '/fabr/fabrDeviceInspection/add',
    method: 'post',
    data: parameter
  })
}

// 设备巡查-分页列表查询
export function aliyunDeviceInspection(pageNo, pageSize, devId, startDate, endDate, flag) {
  return axios({
    url: `/fabr/fabrDeviceInspection/list?pageNo=${pageNo}&pageSize=${pageSize}&devId=${devId == undefined ? '' : devId}&startDate=${startDate == undefined ? '' : startDate}&endDate=${endDate == undefined ? '' : endDate}&flag=${flag == undefined ? '' : flag}`,
    method: 'get',
  })
}

// 设备巡检主表ID查询
export function queryById(id) {
  return axios({
    url: `/fabr/fabrDeviceInspection/queryById?id=${id}`,
    method: 'get',
  })
}

// 设备巡检主表ID查询
export function edit(parameter) {
  return axios({
    url: `/fabr/fabrDeviceInspection/edit`,
    method: 'PUT',
    data: parameter
  })
}

//设备养护-分页列表查询
export function aliyunDeviceCuring(pageNo, pageSize, startDate, endDate, devId) {
  return axios({
    url: `/fabr/fabrDeviceCuring/list?pageNo=${pageNo}&pageSize=${pageSize}&startDate=${startDate == undefined ? '' : startDate}&endDate=${endDate == undefined ? '' : endDate}&devId=${devId == undefined ? '' : devId}`,
    method: 'GET',
  })
}

//设备保修-分页列表查询
export function listRepair(pageNo, pageSize, devId, startDate, endDate, flag) {
  return axios({
    url: `/fabr/fabrDeviceInspection/list?pageNo=${pageNo}&pageSize=${pageSize}&devId=${devId == undefined ? '' : devId}&startDate=${startDate == undefined ? '' : startDate}&endDate=${endDate == undefined ? '' : endDate}&flag=${flag == undefined ? '' : flag}`,
    method: 'get',
  })
}

// 维修设备统计
export function queryDateCount() {
  return axios({
    url: `/fabr/fabrDeviceInspection/queryFaultCount`,
    method: 'GET',
  })
}

// 灌溉一张图-灌溉组信息
export function groupInfo() {
  return axios({
    url: `/fabr/headChart/groupInfo`,
    method: 'GET',
  })
}

// 灌溉一张图-灌溉组信息2
export function planStates() {
  return axios({
    url: `/fabr/headChart/planStates`,
    method: 'GET',
  })
}


// 灌溉一张图-灌溉组信息3
export function deviceStates() {
  return axios({
    url: `/fabr/headChart/deviceStates`,
    method: 'GET',
  })
}

// 灌溉一张图-灌溉组信息4
export function irrigationRecord() {
  return axios({
    url: `/fabr/headChart/irrigationRecord`,
    method: 'GET',
  })
}

// 灌溉一张图-灌溉组信息5
export function pumpHouseDate() {
  return axios({
    url: `/fabr/headChart/pumpHouseDate`,
    method: 'GET',
  })
}

// 灌溉一张图-报警记录
export function callThePolice() {
  return axios({
    url: `/aliyun/irrigationChart/callThePolice`,
    method: 'GET',
  })
}

// 灌溉一张图-阀门控制
export function valveControl() {
  return axios({
    url: `/fabr/headChart/valveControl`,
    method: 'GET',
  })
}

// 阈值设置-添加
export function hspThreshold(parameter) {
  return axios({
    url: `/aliyun/hspThreshold/add`,
    method: 'post',
    data: parameter
  })
}

// 阈值设置-分页列表查询
export function hspThresholdList() {
  return axios({
    url: `/aliyun/hspThreshold/list`,
    method: 'get',
  })
}

// 阈值设置-分页列表查询
export function hspThresholdEdit(parameter) {
  return axios({
    url: `/aliyun/hspThreshold/edit`,
    method: 'PUT',
    data: parameter
  })
}

// 远程监控-整体系统
export function overallSystem() {
  return axios({
    url: `/fabr/fabrDevice/pumpDataList`,
    method: 'get',
  })
}

// 远程监控-历史数据
export function overallSystemList(pageNo, pageSize) {
  return axios({
    url: `/aliyun/hspCollect/list?pageNo=${pageNo}&pageSize=${pageSize}`,
    method: 'get',
  })
}

// 灌溉计划-轮罐组阀门控制
export function lgzConPlan(name, sysTem, planId) {
  return axios({
    url: `/fabr/fabrIrrigationPlan/lgzConPlan?name=${name}&sysTem=${sysTem}&planId=${planId}`,
    method: 'get',
  })
}

// 操作-阀门操作
export function updateDeviceStatus(deviceId) {
  return axios({
    url: `/api/operate/valveOperation?deviceId=${deviceId}`,
    method: 'get',
  })
}

// testDevice
export function testDevice() {
  return axios({
    url: `/aliyun/tecs/testDevice`,
    method: 'get',
  })
}

// 灌溉一张图-所有阀门
export function deviceAll() {
  return axios({
    url: `/aliyun/irrigationChart/deviceAll`,
    method: 'GET',
  })
}

// 设备同步
export function deviceSynchronization() {
  return axios({
    url: `/aliyun/aliyunDevice/deviceSynchronization`,
    method: 'GET',
  })
}


// aliyun_device-泵控制操作
export function pumpControl(deviceId, flag) {
  return axios({
    url: `/api/operate/pumpValveOperation?flag=${flag}&deviceId=${deviceId}`,
    method: 'GET',
  })
}

// 灌溉计划-灌溉记录查询
export function plaNRecordList(pageNo, pageSize, planId, sTime, eTime) {
  return axios({
    url: `/fabr/fabrIrrigationPlan/recordList?pageSize=${pageSize}&pageNo=${pageNo}&planId=${planId}&sTime=${sTime}&eTime=${eTime}`,
    method: 'GET',
  })
}

// 灌溉计划-泵站获取数据
export function pumpStatusShow() {
  return axios({
    url: `/fabr/fabrDevice/pumpInfoList`,
    method: 'GET',
  })
}


// 操作异常表-分页列表查询
export function hspOperationRecord(type_flag, sTime, eTime, pageNo, pageSize) {
  return axios({
    url: `/fabr/fabrOperateRecord/list?type_flag=${type_flag}&sTime=${sTime}&eTime=${eTime}&pageNo=${pageNo}&pageSize=${pageSize}`,
    method: 'GET',
  })
}

// 灌溉计划-计划中止
export function suspensionPlan(id) {
  return axios({
    url: `/fabr/irrigationPlan/suspensionPlan?planId=${id}`,
    method: 'GET',
  })
}


// 灌溉计划-计划中止
export function queryPlan() {
  return axios({
    url: `/fabr/fabrIrrigationPlan/planList`,
    method: 'GET',
  })
}


// 远程监控-折线图
export function historyDate(systemName, yue, rq, cs) {
  return axios({
    url: `/aliyun/remoteMonitoring/historyDate?systemName=${systemName}&yue=${yue}&rq=${rq}&cs=${cs}`,
    method: 'get',
  })
}

// 气象数据-折线图
export function weatherHistoryDate(yue, rq, cs) {
  return axios({
    url: `/fabr/fabrWeather/weatherHistoryDate?yue=${yue}&rq=${rq}&cs=${cs}`,
    method: 'get',
  })
}


// 费用-流量计查询
export function queryFlowmeter(starDate, endDate) {
  return axios({
    url: `/api/cost/queryFlowmeter?starDate=${starDate}&endDate=${endDate}`,
    method: 'get',
  })
}

// 水费管理-余额查询
export function queryBalanceInfo() {
  return axios({
    url: `/fabr/fabrWarterCost/queryBalanceInfo`,
    method: 'get',
  })
}

// 水费管理-预存充值
export function recharge(cost) {
  return axios({
    url: `/fabr/fabrWarterCost/recharge?cost=${cost}`,
    method: 'get',
  })
}

// 费用-流量计查询
export function recordList() {
  return axios({
    url: `/fabr/fabrWaterRecord/recordList`,
    method: 'get',
  })
}


// 阈值设置-添加
export function fabrThreshold(parameter) {
  return axios({
    url: `/fabr/fabrThreshold/add`,
    method: 'post',
    data: parameter
  })
}

// 阈值设置-分页列表查询
export function fabrThresholdList() {
  return axios({
    url: `/fabr/fabrThreshold/list`,
    method: 'get'
  })
}

// 阈值设置-编辑
export function fabrThresholdEdit(parameter) {
  return axios({
    url: `/fabr/fabrThreshold/edit`,
    data: parameter,
    method: 'put',
  })
}

// 设备管理-管网压力查询
export function pipeNetworkList() {
  return axios({
    url: `/fabr/fabrDevice/pipeNetworkList`,
    method: 'get',
  })
}

// 管网压力-分页列表查询
export function fabrPipeNetwork(startDate, endDate, pageSize, pageNo) {
  return axios({
    url: `/fabr/fabrPipeNetwork/list?startDate=${startDate}&endDate=${endDate}&pageSize=${pageSize}&pageNo=${pageNo}`,
    method: 'get',
  })
}

//管网压力-异常报告分页列表查询
export function abnormalList(pageSize, pageNo) {
  return axios({
    url: `/fabr/fabrPipeNetwork/abnormalList?pageSize=${pageSize}&pageNo=${pageNo}`,
    method: 'get',
  })
}

// 墒情监测-墒情图表
export function soilMoistureChart(yue, rq) {
  return axios({
    url: `/fabr/fabrSoilMoisture/soilMoistureChart?yue=${yue}&rq=${rq}`,
    method: 'get',
  })
}

// 墒情监测-墒情图表2
export function querySoilMoisture() {
  return axios({
    url: `/fabr/fabrSoilMoisture/querySoilMoisture`,
    method: 'get',
  })
}

// 气象数据导出
export function weatherHistoryImage(parameter) {
  return axios({
    url: `/fabr/fabrWeather/weatherHistoryImage?image`,
    method: 'post',
    data: parameter,
  })
}

// 首部页面接口-首页报警信息
export function abnormalLists() {
  return axios({
    url: `/fabr/headChart/abnormalList`,
    method: 'get',
  })
}

